package conMgr.prog;

import java.io.File;
import javax.swing.JOptionPane;

import conMgr.data.DataStore;
import conMgr.data.XmlDataStore;
import conMgr.ui.LoginView;

/**
 * Provides static methods for the application, including the main entry point.
 * @author Soon Bang
 */
public class Program
{
	/**
	 * The data store to use for this instance of the program.
	 */
	private static DataStore dataStore;
	
	/**
	 * Private constructor to prevent instantiation.
	 */
	private Program() { }
	
	/**
	 * Gets the data store to use for this instance of the program.
	 * @return The data store to use for this instance of the program.
	 */
	public static DataStore getDataStore()
	{
		return dataStore;
	}
	
	/**
	 * The main entry point of the application.
	 * @param args The command-line arguments used to start this program.
	 */
	public static void main(final String[] args)
	{

		dataStore = new XmlDataStore(new File("data.xml"));
		dataStore.loadAll();

		try
		{
			LoginView login = new LoginView();
			login.setVisible(true);
		}
		catch(Exception e)
		{
			JOptionPane.showMessageDialog(null, e.getMessage());
		}

		
	}
}
